package com.wsm.common.task;

import com.wsm.common.annotation.JobTask;
import com.wsm.oa.domain.Response;
import org.quartz.Job;
import org.quartz.JobDetail;
import org.quartz.JobExecutionContext;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.messaging.simp.SimpMessagingTemplate;
import org.springframework.stereotype.Component;

@JobTask("SendMsgJob")
@Component
public class SendMsgJob implements Job {
    @Autowired
    SimpMessagingTemplate template;

    @Override
    public void execute(JobExecutionContext jobExecutionContext) {
        JobDetail jobDetail = jobExecutionContext.getJobDetail();
        template.convertAndSend("/topic/getResponse", new Response(jobDetail.getDescription()));
    }

}